<template>
  <c-dialog ref="cDialog" hide-btn title="审批记录" @opened="openedHandle">
    <c-table-box ref="cTableBox" index hide-func :setting="false" :other-filters="filtersRaw" :table-config="tableConfig" />
    <div class="btn-container">
      <c-button type="primary" @click="closeDialog">返回</c-button>
    </div>
  </c-dialog>
</template>
<script>
import { otherFiltersItem } from '@/utils'
export default {
  name: 'ApproveLog',
  props: {
    id: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      tableConfig: {
        interfacePath: '/slm-admin/api/v1/designPictureApproval/page',
        setting: [
          {
            prop: 'approverName',
            label: '审批人',
            minWidth: 100
          },
          {
            prop: 'approverPhone',
            label: '审批人电话',
            minWidth: 110
          },
          {
            prop: 'deptName',
            label: '所属部门',
            minWidth: 160
          },
          {
            prop: 'steps',
            label: '审批步骤',
            minWidth: 100
          },
          {
            prop: 'approvalResult',
            label: '审批结果',
            formatData: this.resultHandle,
            minWidth: 100
            // propEnum: {
            //   domainCode: 'marketing',
            //   appCode: 'slm',
            //   dictTypeCode: 'BOOLEANS'
            // }
          },
          {
            prop: 'approvalAdvice',
            label: '审批意见',
            minWidth: 140
          },
          {
            prop: 'lastUpdateTime',
            label: '审批时间',
            minWidth: 140
          }
        ]
      }
    }
  },
  computed: {
    filtersRaw() {
      return [otherFiltersItem('pictureMaintainId', this.id, '=')]
      // return []
    }
  },
  methods: {
    closeDialog() {
      this.$refs.cDialog.visible = false
    },
    openDialog() {
      this.$refs.cDialog.visible = true
    },
    openedHandle() {
      this.$refs.cTableBox.initTableData()
    },
    resultHandle(row) {
      const v = row.approvalResult
      return v === undefined || v === '' || v === null ? '' : v.toString() === '1' ? '同意' : '不同意'
    }
  }
}
</script>
